home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / c / ExtrasLib.lha / ExtrasLib / Source / NextNNStr.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  1.9 KB  |  89 lines

  1. #include <exec/types.h>
  2.  
  3. #include <clib/extras/nnstring_protos.h>
  4.  
  5. /****** extras.lib/NNString_Overview ******************************************
  6. *
  7. *   FUNCTION
  8. *       An NNString is an array of strings, stored end to end, ending
  9. *       with a double NULL.  Individual strings are seperated by NULLs.
  10. *
  11. *   EXAMPLE
  12. *       An NNString representing this array of strings:
  13. *       "Cow" "Dog" "Barn"
  14. *       would look like this:
  15. *       "Cow\0Dog\0Barn\0\0"
  16. *
  17. *   SEE ALSO
  18. *       NextNNStr(), ProcessNNStr, GetEntryData(), AddNNStr(), 
  19. *       NNStrLen()
  20. *
  21. ******************************************************************************
  22. *
  23. */
  24.  
  25.  
  26. /****** extras.lib/NextNNStr ******************************************
  27. *
  28. *   NAME
  29. *       NextNNStr -- Get the next string in a double NULL terminted
  30. *                    string array (aka NNString).
  31. *
  32. *   SYNOPSIS
  33. *       nextstring=NextNNStr(NNString)
  34. *
  35. *       STRPTR NextNNStr(STRPTR);
  36. *
  37. *   FUNCTION
  38. *       returns a pointer to the next string contained in a 
  39. *       double NULL teminated string array, or NULL.
  40. *
  41. *   INPUTS
  42. *       NNString - A pointer to some part of a double NULL string.
  43. *
  44. *   RESULT
  45. *       Pointer to the next string or NULL if there is no string.
  46. *
  47. *   EXAMPLE
  48. *       ** this example steps through an NNString. **
  49. *
  50. *       STRPTR NNString;
  51. *       STRPTR str;
  52. *
  53. *       for(str=NNString; str; str=NextNNStr(str))
  54. *       {
  55. *         printf("%s\n",str);
  56. *       }
  57. *
  58. *       The above can be simplified by using the ProcessNNStr macro
  59. *       defined in extras/nnstring.h
  60. *
  61. *       STRPTR NNString;
  62. *       STRPTR str;
  63. *
  64. *       ProcessNNStr(NNString,str)
  65. *       {
  66. *         printf("%s\n",str);
  67. *       }
  68. *
  69. *   NOTES
  70. *
  71. *   BUGS
  72. *
  73. *   SEE ALSO
  74. *       NNString AddNNStr() ProcessNNStr, extras/macros.h
  75. *
  76. ******************************************************************************
  77. *
  78. */
  79.  
  80. STRPTR NextNNStr(STRPTR Str)
  81. {
  82.   while(*Str)
  83.     Str++;
  84.   Str++; 
  85.   if(!*Str) 
  86.     Str=0;
  87.   return(Str);
  88. }
  89.